﻿Public Class SaveButton
    Inherits BaseControl

    ''' <summary>
    ''' Drives the visibility of the image input element or the asp imageButton and directs behavior into ImageButton clicked event or not.
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Property IsClientScriptSaved As Boolean
    Public Property PendingChangePromptText As String = My.Resources.WebCommon.PendingChangesPrompt

    Protected Const SAVEIMAGEPATH As String = "/Resources/Images/Icons/Save_22.png"
    Protected Const SAVEIMAGEREQUIREDPATH As String = "/Resources/Images/Icons/Save_Required_22.png"

    Public Event SaveClick(sender As Object, e As ImageClickEventArgs)

    Public Sub Page_Init(sender As Object, e As EventArgs) Handles Me.Init
        BasePage.CookieNames.Put(String.Format("{0}_{1}", COOKIE_SAVEREQUIRED, Page.AppRelativeVirtualPath.Substring(Page.AppRelativeVirtualPath.LastIndexOf("/") + 1).Replace(".aspx", String.Empty)))
    End Sub

    Private Sub btnSave_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnSave.Click

        RaiseEvent SaveClick(sender, e)

    End Sub

End Class